﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LinqToLfsWorld
{
	/// <summary>
	/// Describes the response from LfsWorld when handling the <see cref="LfsWorldContext.RequestMade">RequestMade LfsContext event</see>
	/// </summary>
	public class LfsWorldResponse
	{
		/// <summary>
		/// Gets the request url that was originally made to LfsWorld
		/// </summary>
		public string RequestUrl { get; internal set; }

		/// <summary>
		/// Gets the response data that LfsWorld returned
		/// </summary>
		public string ResponseData { get; internal set; }

		/// <summary>
		/// Gets whether or not this response came from the cache or not
		/// </summary>
		public bool FromCache { get; internal set; }
		
		/// <summary>
		/// Gets the length of the returned data
		/// </summary>
		public int ContentLength 
		{
			get
			{
				if (!string.IsNullOrEmpty(ResponseData))
					return ResponseData.Length;
				else
					return 0;
			}
		}
	}
}
